package com.zzchangfu.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.model.function.FunctionCallback;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @program: spring-ai
 * @description:
 * @author: liuChangFu
 * @data: 2025-05-14 16:03
 **/
@Component
public class McpConfig {

    @Bean
    public ChatClient chatClient(ChatClient.Builder chatClientBuilder, FunctionCallback[] tools) {
        // 输出当前可用的工具列表
        System.out.println("可用的 Tools:");
        for (FunctionCallback tool : tools) {
            System.out.println(" - " + tool.getName() + ": " + tool.getDescription());
        }
        return chatClientBuilder
                .defaultFunctions(tools)
                .build();
    }
}
